package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"mall/app/coupon/cmd/rpc/internal/config"
	"mall/app/coupon/model"
)

type ServiceContext struct {
	Config               config.Config
	SeckillSessionModel  model.SmsSeckillSessionModel
	SeckillRalationModel model.SmsSeckillSkuRelationModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := sqlx.NewMysql(c.DataSource)
	return &ServiceContext{
		Config:               c,
		SeckillSessionModel:  model.NewSmsSeckillSessionModel(conn),
		SeckillRalationModel: model.NewSmsSeckillSkuRelationModel(conn),
	}
}
